
<{if $mini_passport}>
<div class="mini-dialog-close close">X</div>
<{/if}>
<div>
  <form method="post" action='<{link app=b2c ctl='site_passport'  act='create' args01=$next_url }>
    ' class='signupform'>
    <div >
      <div class="intro">
        <div class="customMessages">
          <!--register_message-->
        </div>
      </div>
      <div class="loginbox">
        <input name="forward" type="hidden" value="<{$options.url}>">
        <ul>
          <li>
            <label class="leftlabel"><i>*</i><{t}>用户名：<{/t}></label>
            <div class="floatdiv">
              <input type="text" name="pam_account[login_name]" class="inputstyle" vtype="required"  id="reg_user" maxlength="50" onchange="nameCheck(this)">
              <span></span></div>
          </li>
          <li>
            <label class="leftlabel"><i>*</i><{t}>密码：<{/t}></label>
            <div class="floatdiv"><input name="pam_account[login_password]" class="inputstyle" type="password" vtype="required" id="reg_passwd"></div>
          </li>
          <li>
            <label class="leftlabel"><i>*</i><{t}>确认密码：<{/t}></label>
            <div class="floatdiv"><input name="pam_account[psw_confirm]" type="password" class="inputstyle" vtype="required" id="reg_passwd_r">
			<input type="hidden" vtype="change_password" /></div>
          </li>
          <li>
            <label class="leftlabel"><i>*</i><{t}>电子邮箱：<{/t}></label>
            <div class="floatdiv"><input vtype="email&&required"  name="contact[email]" id="reg_email" class="inputstyle" placeholder="yourname@xx.com" onchange="emailCheck(this)"><span></span></div>
          </li>
          <{foreach from=$attr item=item name="item" key='row'}>
          <li>
            <label class="leftlabel"><{if $item.attr_required eq 'true'}><em>*</em><{/if}><{$item.attr_name}>：</label>
            <div class="floatdiv"> <{if $item.attr_type =='date'}>
              <{if $item.attr_value != '0-0-0'}>
              <{if $item.attr_required eq 'true'}>
              <{input class="cal inputstyle" type='date' vtype="required&&date" name=$item.attr_column value=$item.attr_value}>
              <{else}>
              <{input class="cal inputstyle" type='date' name=$item.attr_column value=$item.attr_value}>
              <{/if}>
              <{else}>
              <{if $item.attr_required eq 'true'}>
              <{input class="cal" type="date" vtype="required&&date" name=$item.attr_column}>
              <{else}>
              <{input class="cal" vtype="date" name=$item.attr_column}>
              <{/if}>
              <{/if}>
              <{/if}>

              <{if $item.attr_type =='region'}>
              <{input app=ectools type="region" name=$item.attr_column value=$item.attr_value }>
              <{/if}>

              <{if $item.attr_type =='gender'}>
              <{input type='gender' name=$item.attr_column value=$item.attr_value }>
              <{/if}>

              <{if $item.attr_type =='select'}> <select class="" name='<{$item.attr_column}>' <{if $item.attr_required eq 'true'}>class='_x_ipt ' vtype='required'<{/if}>> <option value='' <{if $item.attr_value == ''}>selected='true'<{/if}>><{t}>请选择<{/t}>
              </option>
              <{foreach from=$item.attr_option item=option name="option"}> <option value='<{$option}>' <{if $item.attr_value == $option}>selected='true'<{/if}>><{$option}>
              </option>
              <{/foreach}>
              </select>
              <{/if}>

              <{if $item.attr_type =='checkbox'}>
              <{foreach from=$item.attr_option item=checkbox name="checkbox" }>
              <input type='checkbox' name=box:<{$item.attr_column}>
              []" value='<{$checkbox}>' <{foreach from=$item.attr_value item=checkboxvalue name="checkboxvalue" }>
              <{if $checkboxvalue==$checkbox}>
              checked ='true'
              <{/if}>
              <{/foreach}>>
              <label><{$checkbox}></label>
              <br/>
              <{/foreach}>
              <input type='hidden' name='<{$item.attr_column}>[]' value='%no%'>
              <{if $item.attr_required eq 'true'}>
              <input type='hidden' class='_x_ipt' vtype='selectc'/>
              <{/if}>
              <{/if}>


              <{if $item.attr_type == 'text'}>
              <input type='text' class="inputstyle" name=<{$item.attr_column}>
              value='<{$item.attr_value}>' vtype='<{if $item.attr_required eq 'true'}>required&&<{/if}><{$item.attr_valtype}>' />
              <{/if}>

              <{if $item.attr_type == 'number'}>
              <input type='text' class="inputstyle" name=<{$item.attr_column}>
              value='<{$item.attr_value}>' vtype='<{if $item.attr_required eq 'true'}>required&&<{/if}><{$item.attr_valtype}>' />
              <{/if}>

              <{if $item.attr_type == 'alpha'}>
              <input type='text' class="inputstyle" name=<{$item.attr_column}>
              value='<{$item.attr_value}>' vtype='<{if $item.attr_required eq 'true'}>required&&<{/if}><{$item.attr_valtype}>' />
              <{/if}> </div>
          </li>
          <{/foreach}>

          <{if $env.conf.b2c.site.register_valide eq 'true'}>
          <li>
            <label class="leftlabel"><i>*</i><{t}>验证码：<{/t}></label>
            <div class="floatdiv"><input vtype="number&&required" size="4" maxlength="4" class="x-input" name="signupverifycode" id="iptsingup"> <span class='verifyCode' style='display:none;'><img src="#" codesrc='<{link app=b2c ctl="site_passport" act="verifyCode" arg0="s"}>' border="1" /><a href="javascript:void(0)">&nbsp;<{t}>看不清楚?换个图片<{/t}></a> </span></div>
          </li>
          <{/if}>
          <li>
            <label class="leftlabel"></label>
            <div class="floatdiv"><span  style="width:auto; text-align:left; font-weight:normal;">
              <input type="checkbox" id="license" name="license" value="agree" checked="checked"/>
              <{t}>我已阅读并同意 <{/t}><a href="<{link app='content' ctl=site_article act=index arg0=36}>" id="terms_error" class="lnk" target='_blank'><span class="FormText" id="terms_error_sym"><{t}>会员注册协议<{/t}></span></a><{t}>和<{/t}><a href="<{link app='content' ctl=site_article act=index arg0=35}>" id="privacy_error" class="lnk" target='_blank'><span class="FormText" id="privacy_error_sym"><{t}>隐私保护政策<{/t}></span></a>。 </span></div>
          </li>
          <li>
            <label class="leftlabel"></label>
            <div class="floatdiv">
			<button type="submit"  rel="_request" class="btn common-btn"><span><span><{t}>注册新用户<{/t}></span></span></button>
              <!-- <input class="actbtn btn-register" type="submit" value="<{t}>注册新用户<{/t}>" /> -->
              <input type="hidden" name="forward" value="<{$forward}>">
            </div>
          </li>
        </ul>

        <{$redirectInfo}> </div>
    </div>
  </form>
  <{if $mini_passport}>
  <li>
    <label></label>
    <div class="floatdiv"><{t}>已有帐号？现在<{/t}><a class="link" href="<{link app="b2c" ctl="site_passport" act="login" mini_passport=1}>"><{t}>登录<{/t}></a></div>
  </li>
  <{/if}> </div>
<{if $valideCode}>
<script>
   void function(formclz){
         var vcodeBox = document.getElement('.'+formclz+' .verifyCode');
         var vcodeImg  =vcodeBox.getElement('img');
         var refreshVcodeBtn  = vcodeBox.getElement('a').addEvent('click',function(e){
              e.stop();
              vcodeImg.src = vcodeImg.get('codesrc')+'?'+(new Date());
         });
         $$('.'+formclz+' input').addEvent('focus',function(){
             if (this.form.retrieve('showvcode',false))return;
             vcodeBox.show();
             refreshVcodeBtn.fireEvent('click',{stop:function(){}});
             this.form.store('showvcode',true);
         });
            document.getElement('.'+formclz+'').addEvent('submit',function(e){
                 var str=$("reg_user").value.trim();
                var len = 0;
                for (var i = 0; i < str.length; i++) {
                    str.charCodeAt(i) > 255? len += 3:len ++;
                }
                if(len<3)return false;
         });
   }('signupform');
</script>
<{/if}>
<script>
function nameCheck(input){

  new Request.HTML({
	url:'<{link app=b2c ctl=site_passport act=namecheck}>',
	update:$(input).getNext(),
	method:'post',
	data:'name='+encodeURIComponent(input.value=input.value.trim())
	}).send();
}

function emailCheck(input){
  new Request.HTML({
	url:'<{link app=b2c ctl=site_passport act=emailcheck}>',
	update:$(input).getNext(),
	method:'post',
	data:'email='+encodeURIComponent(input.value=input.value.trim())
	}).send();
}

(function(){
	var input = $(document.body).getElements('input[name=contact[area]]')[0];
	if(!input)return;
	var select = input.getNext('select');
	select.addEvent('change',function(e){
		if($(e.target).value !='_NULL_'){
			input.getParent('span').set('vtype','area');
		}
		else{
			input.getParent('span').set('vtype','');
		}
	});
})();
</script>
  <script>
   validatorMap['change_password']= ['<{t}>两次输入的密码不一致！<{/t}>', function(element, v) {
		var passwd_re = $('reg_passwd');
		var passwd = $('reg_passwd_r');
		var _is_validate = false;
			if (passwd_re.value == passwd.value) _is_validate = true||_is_validate;
		return _is_validate;
	}];
  </script>